package ke3;
import java.util.*;
//转换整肃
public class trycatch {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int num =0 ;
        String inputstr= "";
        while(true){
            System.out.println("请输入一个整数");
            inputstr = sc.next();
            try{
                num = Integer.parseInt(inputstr);
                break;
            }catch(NumberFormatException e){
                System.out.println("你输入的不是一个整数");
            }
            
        }
        System.out.println(+num);
    }
}
